<template>
  <div>
    <div class="dlg">
      <div class="dlg-header">礼包详情</div>
      <div class="dlg-content">
        <h4>礼包内容</h4>
        <p>{{ usedInfo.cardcontent }}</p>
        <h4>使用说明</h4>
        <p>{{ usedInfo.cardusage }}</p>
        <h4>有限期</h4>
        <p>{{ usedInfo.youxiaoqi }}</p>
      </div>
      <div class="dlg-close" @click="usedClose">关闭</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    cardlist: {
      type: Array,
      default: []
    },
    index: {
      type: Number,
      default: null
    }
  },
  methods: {
    usedClose() {
      this.$emit('used-close')
    }
  },
  computed: {
    usedInfo() {
      if (this.cardlist !== null && this.cardlist && this.index !== null) {
        return this.cardlist[this.index];
      }
    }
  }
};
</script>

<style lang="less" scoped>
.dlg {
  box-sizing: border-box;
  width: 9.2rem;
  height: auto;
  background: #ffffff;
  z-index: 101;
  border-radius: .2rem;
  font-size: .32rem;
}

.dlg-header {
  width: 100%;
  height: 1.173333rem;
  line-height: 1.173333rem;
  font-size: .4rem;
  text-align: center;
  font-weight: 800;
  border-radius: .2rem .2rem 0 0;
  background-color: #ff5543;
  color: #ffffff;
}

.dlg-content {
  box-sizing: border-box;
  padding: 0 .533333rem .4rem;
}

.dlg-content h4 {
  position: relative;
}

.dlg-content h4::before {
  content: "";
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  left: -0.266667rem;
  transform: translateY(-50%);
  width: .133333rem;
  height: .133333rem;
  background: chocolate;
}

.dlg-close {
  width: 100%;
  height: 1.173333rem;
  font-size: .373333rem;
  line-height: 1.173333rem;
  text-align: center;
  border-top: .013333rem solid #949494;
  color: #949494;
  border-radius: 0 0 .2rem .2rem;
}
</style>
